//
//  NSString+KHTML.m
//  Keping
//
//  Created by apple on 2017/11/25.
//  Copyright © 2017年 柯平. All rights reserved.
//

#import "NSString+KHTML.h"

@implementation NSString (KHTML)

/**
 重新解码链接，防止连接中出现中文而出现无法访问的现象
 
 @param urlString 链接
 @return 重新编码的链接
 */
+ (NSString *)encodedStringWithUrlString:(NSString *)urlString{
    if (StringNotEmpty(urlString)) {
        return urlString;
    }
    //    NSString *charactersToEscape = @"`#%^{}\"[]|\\<> ";
    //    NSCharacterSet *allowedCharacters = [[NSCharacterSet characterSetWithCharactersInString:charactersToEscape] invertedSet];
    NSString *encodedUrl = [urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]];
    return encodedUrl;
}

@end
